package com.rabbiter.pm.controller;

import com.rabbiter.pm.domain.vo.AccidentSelectVo;
import com.rabbiter.pm.domain.vo.AccidentVo;
import com.rabbiter.pm.domain.vo.CarInitiateVo;
import com.rabbiter.pm.domain.vo.HandleAccidentVo;
import com.rabbiter.pm.service.AccidentService;
import com.rabbiter.pm.utils.ResultJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin(origins = "*")
@RestController
@RequestMapping("/accident")
public class AccidentController {
    @Autowired
    private AccidentService accidentService;

    @PostMapping("/reporting")
    public ResultJson<Object> reporting(@RequestBody AccidentVo accidentVo){
        return ResultJson.success(accidentService.reportAccident(accidentVo));
    }

    @PostMapping("/all")
    public ResultJson<Object> selectAll(@RequestBody AccidentSelectVo accidentSelectVo){
        return ResultJson.success(accidentService.selectAll(accidentSelectVo));
    }

    @PostMapping("/deal")
    public ResultJson<Object> deal(@RequestBody HandleAccidentVo handleAccidentVo){
        return ResultJson.success(accidentService.dealAccident(handleAccidentVo));
    }
}
